package bookstore.model;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Vector;

public class BookReviewItem {
    private int id;
    private Long userid;
    private String content;
    private List<BookReviewResp> subReview;
    private Date time = new Timestamp(new Date().getTime());

    public BookReviewItem(Long userid, String content) {
        this.userid = userid;
        this.content = content;
        id = this.hashCode();
    }

    public int getId() {
        return id;
    }

    public Long getUserid() {
        return userid;
    }

    public String getContent() {
        return content;
    }

    public Date getTime() {
        return time;
    }

    public List<BookReviewResp> getSubReview() {
        if (subReview == null) {
            subReview = new Vector<>();
        }
        return subReview;
    }

    @Override
    public int hashCode() {
        return Objects.hash(userid, content);
    }
}
